<script>
	$(function(){
		// 初始化计算均值
		$(".ave").each(function() {
			var add = $(this).parents("tr").find('.measure').map(function(){
				return $(this).text() || 0.0;
			}).get();
			var ave = eval(add.join('+')) / add.length;  // 计算平均值
			if(ave!=0) {
				// 最大差值总在数组的最大或最小值中产生
				var a = Math.max.apply(null, add)-ave;
				var b = Math.min.apply(null, add)-ave;
				var dmax = Math.abs(a)>=Math.abs(b)?a:b;
				$(this).text(ave.toFixed(1));
				$(this).parents("tr").find(".dmax").text(dmax.toFixed(1));
			}
		});
	})
</script>

<blockquote class="layui-elem-quote slideBtn"><span><{$title}></span><i class="icon-up"></i></blockquote>

<notempty name="node.node">
<div>
	<table class="tbst">
		<thead>
			<tr>		
				<th rowspan="2">测量内容</th>
				<th colspan="5">读数</th>
				<th rowspan="2">平均值</th>
				<th rowspan="2">最大差值</th>
				<th rowspan="2">测量图片</th>
			</tr>
			<tr>
				<th>1</th>
				<th>2</th>
				<th>3</th>
				<th>4</th>
				<th>5</th>
			</tr>
		</thead>
		<tbody>
			<foreach name="node.node" item="vo">
				<tr>
					<th><{$key}></th>
					<td class="measure"><{$vo['val'][0]}></td>
					<td class="measure"><{$vo['val'][1]}></td>
					<td class="measure"><{$vo['val'][2]}></td>
					<td class="measure"><{$vo['val'][3]}></td>
					<td class="measure"><{$vo['val'][4]}></td>
					<td class="ave"></td>
					<td class="dmax"></td>
					<td>
						<foreach name="vo.pic" item="voo">
							<a class="thumbnail" href="#">
								FIG
								<span><img src="/<{:C('DATA_IMAGES').$key}>" alt="<{$voo}>" width="250" border="0"></span>
							</a>
						</foreach>
					</td>
				</tr>
			</foreach>
		</tbody>
	</table>
	<blockquote class="layui-elem-quote end"><i class="icon icon-noticeText"></i>THE END!</blockquote>
</div>
<else/>
	<blockquote class="layui-elem-quote layui-quote-nm">Nothing is found...</blockquote>
</notempty>

